package com.corechina.apex_osswords.domain.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.corechina.apex_osswords.domain.entity.CoreProjectUser;
import com.corechina.apex_osswords.domain.vo.CoreMaintenanceEngineerVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

/**
 * <p>
 * 项目--人员配置表 Mapper 接口
 * </p>
 *
 * @author cc
 * @since 2022-03-11
 */
@Component
public interface CoreProjectUserMapper extends BaseMapper<CoreProjectUser> {

    IPage<CoreMaintenanceEngineerVo> getProjectPersonnelList(Page page, @Param("queryType") Integer queryType, @Param("projectId") Integer projectId, @Param("name") String name, @Param("company") String company, @Param("engineerType") Integer engineerType);

    @Select("select count(1) from core_project_user where user_id = #{userId} and project_id = #{projectId}")
    int getCountByUserAndProject(@Param("userId") Integer userId, @Param("projectId") Integer projectId);

    int deleteByProject(@Param("engineer") Integer engineer, @Param("enterpriseId") Integer enterpriseId, @Param("serviceId") Integer serviceId);

}
